<?php 
//2.将html文档中的所有a链接替换为http://www.houdunwang.com
$str = <<<str
	<li class="navto-search"><a href="javascript:;" class="search-show active"><i class="fa fa-search"></i></a></li>
			</ul>
	<div class="topbar">
		<ul class="site-nav topmenu">
			<li><a href="http://www.daqianduan.com/ads">广告合作</a></li>
			<li><a href="http://www.daqianduan.com/contact">联系我们</a></li>
			<li><a href="http://www.daqianduan.com/tools">前端工具箱</a></li>
			<li><a href="http://www.daqianduan.com/links">友情链接</a></li>
			<li>
				<a href="http://www.daqianduan.com/about">关注大前端 <i class="fa fa-angle-down"></i></a>
				<ul class="sub-menu">
					<li><a target="_blank" rel="external nofollow" href="http://www.daqianduan.com/go/feedmail"><i class="fa fa-envelope-o"></i> 邮件订阅更新</a></li>
					<li><a target="_blank" href="http://www.daqianduan.com/feed"><i class="fa fa-rss"></i> RSS订阅</a></li>
				</ul>
			</li>
		</ul>
			</div>
	<i class="fa fa-bars m-icon-nav"></i>
</div>
</header>
<div class="site-search">
<div class="container">
	<form method="get" class="site-search-form" action="http://www.daqianduan.com/" >
		<input class="search-input" name="s" type="text" placeholder="输入关键字搜索"><button class="search-btn" type="submit"><i class="fa fa-search"></i></button>
	</form>
</div>
</div>
<section class="container">
	<div class="content-wrap">
	<div class="content">
				<div id="homeslider" class="carousel slide" data-ride="carousel"><ol class="carousel-indicators"><li data-target="#homeslider" data-slide-to="0" class="active"></li><li data-target="#homeslider" data-slide-to="1"></li><li data-target="#homeslider" data-slide-to="2"></li></ol><div class="carousel-inner" role="listbox"><div class="item active"><a target="_blank" href="http://themebetter.com/theme/xiu"><img src="http://www.daqianduan.com/wp-content/uploads/2014/11/hs-xiu.jpg" alt="xiu主题"></a></div><div class="item"><a target="_blank" href="http://www.daqianduan.com/job-new"><img src="http://www.daqianduan.com/wp-content/uploads/2014/11/hs-job.jpg" alt="免费前端招聘"></a></div><div class="item"><a target="_blank" href="http://www.daqianduan.com/nav"><img src="http://www.daqianduan.com/wp-content/uploads/2014/11/hs-nav.jpg" alt="前端开发导航"></a></div></div><a class="left carousel-control" href="#homeslider" role="button" data-slide="prev"><i class="fa fa-angle-left"></i></a><a class="right carousel-control" href="#homeslider" role="button" data-slide="next"><i class="fa fa-angle-right"></i></a></div>						<article class="excerpt-see excerpt-see-Index"><h2><a class="red" href="http://www.daqianduan.com/job">【前端招聘】</a> <a href="http://www.daqianduan.com/6330.html" title="珍爱网诚聘高级前端开发工程师（深圳 10K+）_大前端">珍爱网诚聘高级前端开发工程师（深圳 10K+）</a></h2><p class="note">珍爱网（www.zhenai.com） 是国内最知名的婚恋服务网站之一。以“成就天下姻缘”为己任，服务于有婚恋需求的广大单身男女人士。珍爱总部位于中国深圳，同时在北京、上海、广州、成都、武汉等主要城市均设有分公司。目前网站注册用户已达到90...</p></article>		<div class="title">
str;
//<a href="http://www.daqianduan.com/ads">
$preg ='/(href=\"http:\/\/www\.)(.*?)(\")/i';
//preg_match_all($preg, $str, $arr);
//echo '<pre>';
//print_r($arr);
//echo '</pre>';
$newArr = preg_replace_callback($preg, 'func', $str);
function func($arr){
	return $arr[1] . "houdunwang.com" . $arr[3];
}
//$newArr=preg_replace($preg, '"\1" . "houdunwang.com" . "\3"', $str);
echo $newArr;






 ?>